<?php
/**
* @version		$Id: dynl_catalog.php 6257 2007-01-11 22:03:46Z friesengeist $
* @package		Dynlist
* @copyright	Copyright (C) 2005 - 2007 Dynlist. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Dynlist is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
/**
* Dynlist Catalog class
*
* Manage the catalog of all Dynlists in the repository.
*
* @package		Dynlist
* @final
*/
class Dynl_catalog
{
	/**
	 * Singleton instance.
	 *
	 * @var object Dynl_catalog object
	 * @access private
	 */
	var $_instance;
	
	/**
	 * Database instance.
	 *
	 * @var object db_catalog object
	 * @access private
	 */
	var $_database;
	

	/**
	 * HTML instance.
	 *
	 * @var object html_catalog object
	 * @access private
	 */
	var $_html;
	
	/**
	 * A list of all Dynlists on repository.
	 *
	 * @var array
	 * @access protected
	 */
	var $_data = null;

	/**
	* Class constructor
	*
	* @access protected
	* @param
	*/
	function dynl_catalog()
	{
		$this->_database = new dynl_database('dynlcat');
		$this->_html = new html_dynlcat();

		// Set filters to select.
		$fields = array('dbtabname','dynlname');
		
		// Retrieve data from database.
		$this->_data = $this->_database->retrieve($fields,'all','none');

	}

	/**
	* Returns the instance created or if not created, create new.
	* It's ensure that this class be a singleton pattern.
	*
	* @access protected
	* @param char xcode
	*/
	function get_instance()
	{
		
		if (!isset($this->_instance)) {
			$this->_instance = new dynl_catalog();
		}
		
		return $this->_instance;
	}
	
	
	/**
	* Invocated HTML render to show Dynlist Catalog.
	*
	* @access public
	*/
	function show_catalog()
	{
		// Set SQL command.
		//$this->_database->set_sql_command();
		
		// Retrieve data from database.
		//$this->_data = $this->_database->retrieve_data();
		
		// Set page data;
		$this->_html->set($this->_data);
		//$rec = $this->_data[1];
		//print_r($this->_data);
		// Render page;
		$this->_html->render_page();
		
	}

	/**
	* Invocated HTML render to show Dynlist data.
	*
	* @access public
	*/
	function show_data()
	{
		echo "show";		
	}

	/**
	* Manage the creation of new structure.
	*
	* @access public
	*/
	function new_structure()
	{
		
	}

	/**
	* Manage the creation of new structure.
	*
	* @access public
	*/
	function edit_structure()
	{
		
	}

	/**
	* Delete strucure of Dynlist.
	*
	* @access public
	*/
	function delete_structure()
	{

	}
}
?>
